﻿using UnityEngine;
using System.Collections;
using Vuforia;

public class VirtualButtonEventHandler : MonoBehaviour,
IVirtualButtonEventHandler
{

	// Use this for initialization
	void Start ()
	{
		VirtualButtonBehaviour[] vbs = GetComponentsInChildren<VirtualButtonBehaviour> ();
		for (int i = 0; i < vbs.Length; ++i) {
			vbs [i].RegisterEventHandler (this);
		}
	}
	
	// Update is called once per frame
	void Update ()
	{
	
	}
	
	public void OnButtonPressed (VirtualButtonAbstractBehaviour vb)
	{
		print ("Press button info:" + vb.VirtualButtonName);
		if (vb.VirtualButtonName == "TakePhoto") {
			Camera.main.gameObject.SendMessage ("TakePhoto");
		} else if (vb.VirtualButtonName == "Reset") {
			GameObject.Find ("TempObj").SendMessage ("Reset");
		}
	}
	
	public void OnButtonReleased (VirtualButtonAbstractBehaviour vb)
	{
		print ("OnButtonReleased");
		
	}
	
	private bool IsValid ()
	{
		print ("Is valid");
	
		return false;
	}
}
